/*
 * SymbianSDKSensors.h
 *
 *  Created on: 22.12.2009
 *      Author: Anssi
 */

#ifndef SYMBIANSDKSENSORS_H_
#define SYMBIANSDKSENSORS_H_

#include <QString>

#include <sensrvdatalistener.h>
#include "sensors.h"
#include "sensordatalistener.h"

class CSensrvChannel;

class SymbianSDKSensors
	{
public:
	SymbianSDKSensors(Sensors &sensors);
	virtual ~SymbianSDKSensors();
	
	void findSensorChannel(const QString &criteria);
	
	int registerForNotification(int ChannelId, 
								int ContextType, 
								int Quantity, 
								int ChannelType, 
								const QString &location, 
								const QString &VendorId, 
								int DataItemSize, 
								int ChannelDataTypeId);
	
	void getChannelProperty(const QString &listeningType, 
								int ChannelId, 
								int ContextType, 
								int Quantity, 
								int ChannelType, 
								const QString &location, 
								const QString &VendorId, 
								int DataItemSize, 
								int ChannelDataTypeId, 
								const QString &PropertyId);
	void cancel(int criteria);

private:
	class TransactionObject
		{
		public:
			TransactionObject(CSensrvChannel *channel, CSensorDataListener *dataListener) :
				m_channel(channel), m_dataListener(dataListener) {}
			
			~TransactionObject() { delete m_channel; delete m_dataListener; }
			
			CSensrvChannel 		*m_channel;
			CSensorDataListener *m_dataListener;
		};
	
	Sensors &m_sensors;
	int		m_transactionID;
	QMap<int, TransactionObject*> m_transactions; // transactionID, transactions	
	};

#endif /* SYMBIANSDKSENSORS_H_ */
